package string;

public class StringEqualsDemo {
    public static void main(String[] args) {
        String s1 = "abc";
        String s2 = "abc";//相同字面量创建时会重用对象

        System.out.println(s1==s2);
        System.out.println(s1.equals(s2));//比较两个字符串内容是否相同

        String s3 = new String("abc");
        System.out.println("s3:"+s3);//false
        System.out.println(s1.equals(s3));//true

    }
}
